<template>
  <div class="not-found-page">
    <div class="not-found-content">
      <div class="not-found-illustration">
        <el-icon size="200" color="#e6e8eb">
          <DocumentDelete />
        </el-icon>
      </div>
      
      <div class="not-found-info">
        <h1 class="error-code">404</h1>
        <h2 class="error-title">页面不存在</h2>
        <p class="error-description">
          抱歉，您访问的页面不存在或已被移除。
          <br>
          请检查网址是否正确，或返回首页重新开始。
        </p>
        
        <div class="action-buttons">
          <el-button type="primary" size="large" @click="goHome">
            <el-icon><House /></el-icon>
            返回首页
          </el-button>
          <el-button size="large" @click="goBack">
            <el-icon><Back /></el-icon>
            返回上页
          </el-button>
        </div>
      </div>
    </div>
    
    <div class="quick-links">
      <h3>快速导航</h3>
      <div class="links-grid">
        <router-link to="/" class="quick-link">
          <el-icon><House /></el-icon>
          <span>首页</span>
        </router-link>
        <router-link to="/login" class="quick-link">
          <el-icon><User /></el-icon>
          <span>登录</span>
        </router-link>
        <router-link to="/register" class="quick-link">
          <el-icon><UserFilled /></el-icon>
          <span>注册</span>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'
import { DocumentDelete, House, Back, User, UserFilled } from '@element-plus/icons-vue'

export default {
  name: 'NotFound',
  components: {
    DocumentDelete,
    House,
    Back,
    User,
    UserFilled
  },
  setup() {
    const router = useRouter()

    const goHome = () => {
      router.push('/')
    }

    const goBack = () => {
      if (window.history.length > 1) {
        router.go(-1)
      } else {
        router.push('/')
      }
    }

    return {
      goHome,
      goBack
    }
  }
}
</script>

<style lang="scss" scoped>
.not-found-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 40px 20px;

  .not-found-content {
    text-align: center;
    margin-bottom: 60px;

    .not-found-illustration {
      margin-bottom: 40px;
      animation: float 3s ease-in-out infinite;
    }

    .not-found-info {
      .error-code {
        font-size: 120px;
        font-weight: bold;
        color: #409eff;
        margin: 0 0 20px 0;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
      }

      .error-title {
        font-size: 36px;
        color: #333;
        margin: 0 0 20px 0;
        font-weight: 600;
      }

      .error-description {
        font-size: 18px;
        color: #666;
        line-height: 1.6;
        margin: 0 0 40px 0;
        max-width: 500px;
      }

      .action-buttons {
        display: flex;
        justify-content: center;
        gap: 20px;
        flex-wrap: wrap;
      }
    }
  }

  .quick-links {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 300px;

    h3 {
      text-align: center;
      color: #333;
      margin: 0 0 20px 0;
      font-size: 20px;
    }

    .links-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 15px;

      .quick-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 20px 15px;
        border: 1px solid #e4e7ed;
        border-radius: 8px;
        text-decoration: none;
        color: #666;
        transition: all 0.3s;

        &:hover {
          border-color: #409eff;
          color: #409eff;
          transform: translateY(-2px);
          box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
        }

        .el-icon {
          margin-bottom: 8px;
          font-size: 24px;
        }

        span {
          font-size: 14px;
          font-weight: 500;
        }
      }
    }
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

@media (max-width: 768px) {
  .not-found-page {
    padding: 20px;

    .not-found-content {
      .not-found-info {
        .error-code {
          font-size: 80px;
        }

        .error-title {
          font-size: 28px;
        }

        .error-description {
          font-size: 16px;
        }

        .action-buttons {
          flex-direction: column;
          align-items: center;
        }
      }
    }

    .quick-links {
      min-width: auto;
      width: 100%;
      max-width: 400px;

      .links-grid {
        grid-template-columns: 1fr;
        gap: 10px;

        .quick-link {
          flex-direction: row;
          justify-content: flex-start;
          text-align: left;

          .el-icon {
            margin-bottom: 0;
            margin-right: 12px;
          }
        }
      }
    }
  }
}
</style> 